#include "JsonLexParser.h"
#include "JsonParserObject.h"
//#include "JsonGrammerParser.h"

#include "Json_Grammer_Action.h"
#include <iostream>
// #include <iostream>
// #include <fstream>
using namespace std;

const int END_OF_FILE =-1;
char currChar ; //当前 正在解析的字符
FILE * fp;
char * sourceFileName ;


Token currToken;
char * currString;
int currIntNumber;
float currFloatNumber;
bool currBoolValue;

JsonObject * final_JsonObject ;
JsonArray *  final_JsonArray ;


int main()
{
    sourceFileName =(char*) "test.json";
    fp = fopen(sourceFileName,"r");
    // read(fp,&currChar,1);
    // cout<<currChar<<endl;
    int t = f_program_start();
    if(t==1)
    {
        printJsonObject(*final_JsonObject,0);
    }
    else if(t==2)
    {
        printJsonArray(*final_JsonArray,0);
    }
    
    // char * a = (char*)"asfsda";
    // string s (a);
    // cout<<s<<endl;
    
    // Value * va1 = (Value *)malloc(sizeof(Value));
    // Value * va2 = (Value *)malloc(sizeof(Value));
    // Value * va3 = (Value *)malloc(sizeof(Value));
    // va1->type = STRING;
    // va1->String = string((char*)"carl");

    // va2->type = I_NUMBER;
    // va2->i_number = 10;

    // va3->type = F_NUMBER;
    // va3->f_number = 2.0;
    
    // JsonObject jObj;
    // jObj.put("va1",*va1);
    // jObj.put("va2",*va2);
    // jObj.put("va3",*va3);
    // printJsonObject(jObj,1);
    // cout<<endl;

    // JsonObject obj2 = jObj;

    // Value * va4 = (Value *)malloc(sizeof(Value));
    // va4->Json_Object = & jObj;
    // va4->type = OBJECT;

    // obj2.put("object",*va4);
    // printJsonObject(obj2,0);

    // map<char*,int> mymap;
    // char* a = (char*) "hello";
    // mymap.emplace(a,4);
    



    return 0;
}
